home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.applet.AudioClip;
- import java.awt.Button;
- import java.awt.Checkbox;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.FlowLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLEncoder;
- import java.util.EventObject;
-
- public class CheckBoxLink extends Applet implements MouseListener, ActionListener {
- // $FF: renamed from: wi int
- private int field_0;
- // $FF: renamed from: he int
- private int field_1;
- private int n_link = 1;
- // $FF: renamed from: cb java.awt.Checkbox[]
- private Checkbox[] field_2;
- private String buttonText;
- private String statusBarText;
- private AudioClip sound;
- private AudioClip clicSound;
- private boolean loopSound;
- private Color backColor;
- private Color enterBackColor;
- private Color checkColor;
- private Color enterCheckColor;
- private Color buttonColor;
- private Color enterButtonColor;
- // $FF: renamed from: b java.awt.Button
- private Button field_3;
-
- public String getAppletInfo() {
- return "Name: CheckBoxLink\r\nAuthor: Taiji Software\r\n";
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- this.stop();
- } catch (Exception e) {
- System.out.println(e);
- this.stop();
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var9) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
- this.field_2 = new Checkbox[this.n_link];
- ((Container)this).setLayout(new FlowLayout());
- String s = ((Applet)this).getParameter("checkboxes_color");
- if (s != null && s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int l = Integer.parseInt(s, 16);
- this.checkColor = new Color(l);
- }
-
- for(int i = 0; i < this.n_link; ++i) {
- this.field_2[i] = new Checkbox(((Applet)this).getParameter("text" + Integer.toString(i + 1)));
- String initialState = ((Applet)this).getParameter("checked" + Integer.toString(i + 1));
- if (initialState != null) {
- if (initialState.equalsIgnoreCase("no")) {
- this.field_2[i].setState(false);
- }
- } else {
- this.field_2[i].setState(true);
- }
-
- this.field_2[i].setBackground(this.checkColor);
- ((Container)this).add(this.field_2[i]);
- }
-
- this.field_3 = new Button(this.buttonText);
- if (this.buttonColor != null) {
- this.field_3.setBackground(this.buttonColor);
- } else {
- this.buttonColor = this.field_3.getBackground();
- }
-
- this.field_3.addActionListener(this);
- ((Container)this).add(this.field_3);
- if (this.sound != null) {
- if (this.loopSound) {
- this.sound.loop();
- return;
- }
-
- this.sound.play();
- }
-
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- this.backColor = this.getColor("background_color");
- ((Component)this).setBackground(this.backColor);
- this.enterBackColor = this.getColor("enter_background_color");
- this.enterCheckColor = this.getColor("enter_checkboxes_color");
- this.buttonColor = this.getColor("button_color");
- this.enterButtonColor = this.getColor("enter_button_color");
- this.buttonText = ((Applet)this).getParameter("button_text");
- this.statusBarText = ((Applet)this).getParameter("status_bar_text");
- if (this.buttonText == null) {
- this.buttonText = "Go !!";
- }
-
- String s = ((Applet)this).getParameter("number");
- if (s != null) {
- this.n_link = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("sound_name");
- if (s != null) {
- this.sound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- s = ((Applet)this).getParameter("loop_sound");
- if (s != null) {
- if (s.equals("yes")) {
- this.loopSound = true;
- } else {
- this.loopSound = false;
- }
- }
-
- s = ((Applet)this).getParameter("clic_sound_name");
- if (s != null) {
- this.clicSound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- }
-
- public Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public void actionPerformed(ActionEvent event) {
- if (((EventObject)event).getSource() instanceof Button) {
- if (this.clicSound != null) {
- this.clicSound.play();
- }
-
- String target = ((Applet)this).getParameter("target");
- if (target == null) {
- target = "_blank";
- }
-
- for(int i = 0; i < this.n_link; ++i) {
- if (this.field_2[i].getState()) {
- URL u = this.giveURL(((Applet)this).getParameter("link" + Integer.toString(i + 1)));
- ((Applet)this).getAppletContext().showDocument(u, target);
- }
- }
-
- }
- }
-
- public void stop() {
- if (this.sound != null) {
- this.sound.stop();
- }
-
- }
-
- public URL giveURL(String url) {
- try {
- if (url.toUpperCase().startsWith("HTTP")) {
- return new URL(url);
- } else if (url.toUpperCase().startsWith("FTP")) {
- int p = url.indexOf(":");
- int p2 = url.indexOf(":", p + 1);
- if (p2 != -1) {
- url = url.substring(0, p + 3) + URLEncoder.encode(url.substring(p + 3, url.length()));
- }
-
- p = url.indexOf("%40");
- if (p != -1) {
- url = url.substring(0, p) + "@" + url.substring(p + 3, url.length());
- }
-
- return new URL(url);
- } else {
- return new URL(((Applet)this).getCodeBase(), url);
- }
- } catch (MalformedURLException e) {
- System.out.println(e);
- return null;
- }
- }
-
- public void mouseClicked(MouseEvent e) {
- }
-
- public void mouseEntered(MouseEvent e) {
- if (this.statusBarText != null) {
- ((Applet)this).showStatus(this.statusBarText);
- }
-
- if (this.enterBackColor != null) {
- ((Component)this).setBackground(this.enterBackColor);
- ((Component)this).repaint();
- }
-
- if (this.enterButtonColor != null) {
- this.field_3.setBackground(this.enterButtonColor);
- ((Component)this).repaint();
- }
-
- if (this.enterCheckColor != null) {
- for(int i = 0; i < this.n_link; ++i) {
- this.field_2[i].setBackground(this.enterCheckColor);
- }
-
- ((Component)this).repaint();
- }
-
- }
-
- public void mouseExited(MouseEvent e) {
- if (this.enterBackColor != null) {
- ((Component)this).setBackground(this.backColor);
- ((Component)this).repaint();
- }
-
- if (this.enterCheckColor != null) {
- for(int i = 0; i < this.n_link; ++i) {
- this.field_2[i].setBackground(this.checkColor);
- }
-
- ((Component)this).repaint();
- }
-
- if (this.enterButtonColor != null) {
- this.field_3.setBackground(this.buttonColor);
- ((Component)this).repaint();
- }
-
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- public CheckBoxLink() {
- ((Component)this).addMouseListener(this);
- }
- }
-